package com.hymjweb.demo.hymj.customer_manage.freight_agreement.detail.controller;

import com.hymjweb.demo.framework.result.BaseResultMap;
import com.hymjweb.demo.framework.sys.BaseController;
import com.hymjweb.demo.framework.util.DataTypeUtil;
import com.hymjweb.demo.hymj.customer_manage.freight_agreement.detail.bean.BCustomerFeightAgreementDetailPojo;
import com.hymjweb.demo.hymj.customer_manage.freight_agreement.detail.service.BCustomerFeightAgreementDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @BelongsProject: demo
 * @BelongsPackage: com.hymjweb.demo.hymj.customer_manage.freight_agreement.detail.controller
 * @Author: luoge
 * @CreateTime: 2021-01-21 18:03
 * @Description:
 */

@Controller
@RequestMapping("/pages/customer_manage/freight_agreement/detail")
public class BCustomerFeightAgreementDetailController extends BaseController {

    @Autowired
    private BCustomerFeightAgreementDetailService bCustomerFeightAgreementDetailService;


    @RequestMapping("/getDetailListByAgreementFreightId")
    @ResponseBody
    public Object getDetailListByAgreementFreightId(String agreementFreightId) throws Exception {
        if(DataTypeUtil.isEmptyStr(agreementFreightId)){
            throwException("没有协议运价ID,无法加载协议运价列表!");
        }

        List<BCustomerFeightAgreementDetailPojo> detailPojos = bCustomerFeightAgreementDetailService.getDetailListByAgreementFreightId(agreementFreightId);

        BaseResultMap baseResultMap = new BaseResultMap();
        baseResultMap.setOk(true);
        baseResultMap.setMessage("加载数据成功!");
        baseResultMap.setData(detailPojos);

        return baseResultMap;
    }





}
